<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <!--/*@thymesVar id="userModel" type="com.ma.model.UserModel"*/-->
    <div th:if="${userModel} eq null">
        <form th:action="addUser" th:method="post">
    </div>

    <div th:if="${userModel} ne null">
        <form th:action="updateUser" th:method="post">
    </div>

    <table>
    <tr>
        <th>用户名</th>
        <td><input th:type="text" th:name="name" th:value="${userModel == null? '' : userModel.name}" th:title="请输入用户名"/></td>
    </tr>
    <tr>
        <th>密码</th>
        <td><input th:type="password" th:name="password" th:title="请输入密码"/></td>
    </tr>
    <tr>
        <th>年龄</th>
        <td><input th:type="number" th:name="age" th:value="${userModel == null? '' : userModel.age}" th:title="请输入年龄"/></td>
    </tr>
    <tr><td th:colspan="2" ><input th:type="submit" th:value="提交" /></td></tr>
    </table>
    <input th:type="hidden" th:name="id" th:value="${userModel == null? null : userModel.id}" />
</form>

</body>
</html>
